package cn.ultrarisk.scadmin.manager.web.controller.collection;

import cn.ultrarisk.scadmin.manager.biz.solr.dto.CollectionDeleter;
import cn.ultrarisk.scadmin.manager.biz.solr.service.SolrDataService;
import cn.ultrarisk.scadmin.manager.web.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.io.IOException;

/**
 * OverviewController
 *
 * @author sevendlong(lin23871@163.com)
 * @date 2014/4/17
 * @since V1.0
 */
@Controller
@RequestMapping(value = "/collection/{id}/delete")
public class DeleteController extends BaseController {
    @Autowired
    private SolrDataService solrDataService;

    @ResponseBody
    @RequestMapping(value = "")
    public ResponseEntity<String> delete(@PathVariable("id") Integer id, CollectionDeleter deleter) throws IOException {
        return getOkResponseEntity(solrDataService.delete(id, deleter));
    }
}
